package com.koron.configure.shiftTip.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.configure.shiftTip.bean.po.ConfigureShiftTip;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 交接事项(ConfigureShiftTip)表服务接口
 *
 * @author jzp
 * @since 2021-10-27 18:36:23
 */
public interface ConfigureShiftTipService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    ConfigureShiftTip getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param classesTip 查询条件对象
     * @return 列表结果集
     */
    List<ConfigureShiftTip> list(SessionFactory factory, ConfigureShiftTip classesTip);

    List<ConfigureShiftTip> listByDockingId(SessionFactory factory, String dockingId);

    int getMaxSort(SessionFactory factory, String dockingId, String firstLevel, String secondLevel);

    int getMergeMaxSort(SessionFactory factory, ConfigureShiftTip classesTip);

    void setMaxSort(SessionFactory factory, ConfigureShiftTip classesTip);

    /**
     * 分页查询
     * classesTip 分页对象
     *
     * @return 对象列表
     */
    default PageInfo<ConfigureShiftTip> page(SessionFactory factory, PageQuery pageQuery, ConfigureShiftTip classesTip) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<ConfigureShiftTip> classesTipList = list(factory, classesTip);
        return new PageInfo<>(classesTipList);
    }

    /**
     * 新增数据
     *
     * @param classesTip 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, ConfigureShiftTip classesTip);

    boolean insert(SessionFactory factory, ConfigureShiftTip classesTip);

    boolean saveBatch(SessionFactory factory, List<ConfigureShiftTip> tips);

    /**
     * 修改数据
     *
     * @param classesTip 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, ConfigureShiftTip classesTip);

    /**
     * 通过主键删除数据
     *
     * @param ids 主键
     * @return 是否成功
     */
    boolean deleteBatchIds(SessionFactory factory, List<String> ids);

    boolean removeByDockingId(SessionFactory factory, String dockingId);

}
